import type { roomType } from '@/props/room'
import { useUserStore } from '@/stores/user'
import requests from '@/utils/request'

const userStore =  useUserStore()
const userId = userStore.userId

export const getUserRoom = () => {
  const userStore = useUserStore()
  return requests.get(`/feng/room/${userStore.userId}`)
}

export const getRoomType = () => {
  return requests.get('/feng/room/roomType')
}

export const addRoom = ({roomTypeId,roomName}:roomType) => {
  return requests.post('/feng/room/addRoom',{
    roomTypeId,
    roomName,
    userId
  })
}

export const getRoomDeviceCollections = (roomId:string) => {
  return requests.get(`/feng/room/getRoomDeviceCollections/${roomId}`)
}

export const addDeviceCollection = (roomId:number|null,deviceCollectionName:string) => {
  return requests.post('/feng/room/addDeviceCollection',{
    roomId,
    deviceCollectionName
  })
}
